package com.ljl.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author 刘家良
 * @date 2022/09/10 23:17
 * @description
 */
@Data
@Entity
@Table(name = "account")
public class Account implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column
    private String username;

    @JSONField(serialize = false)
    private String password;

    @Column(name = "nick_name")
    private String nickName;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")
    @CreationTimestamp
    @Column(name = "create_time", updatable = false)
    private Timestamp createTime;

    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone ="GMT+8")
    @UpdateTimestamp
    @Column(name = "update_time")
    private Timestamp updateTime;

}
